<script lang="ts" setup>
import { NResult, NButton } from "naive-ui";
import { useRouter } from "vue-router";
const { replace } = useRouter();

const hasBack = history.state.back;

const toHome = () => {
  replace("/");
};

const back = () => {
  replace(history.state.back);
};
</script>

<template>
  <NResult
    class="error-page-center"
    size="large"
    status="403"
    title="403 禁止访问"
    description="抱歉，您暂无权限访问，请联系管理员开通权限。"
  >
    <template #footer>
      <div class="footer">
        <NButton v-if="hasBack" type="primary" ghost @click="back"> 回上一页 </NButton>
        <NButton type="primary" class="ml-20" @click="toHome">返回首页</NButton>
      </div>
    </template>
  </NResult>
</template>

<style lang="less" scoped>
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
}
</style>
